package sopt.dev.data;

import java.util.ArrayList;

import sopt.dev.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class SettingAdapter extends ArrayAdapter<Setting> {
	Context context = null;
	private ArrayList<Setting> items;

	public SettingAdapter(Context context, int textViewResourceId,
			ArrayList<Setting> items) {
		super(context, textViewResourceId, items);
		this.context = context;
		this.items = items;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = vi.inflate(R.layout.setting_item, null);
		}
		Setting s = items.get(position);
		if (s != null) {
			TextView tv_title = (TextView) convertView
					.findViewById(R.id.setting_tv_title);
			TextView tv_info = (TextView) convertView
					.findViewById(R.id.setting_tv_info);
			if (tv_title != null) {
				tv_title.setText(s.getTitle());
			}
			if (tv_info != null) {
				tv_info.setText(s.getInfo());
			}
		}
		return convertView;
	}




}
